<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jquery-3.7.1.min.js"></script>
    <style>
       .box{
        width: 200px;
        height: 200px;
        background-color: red;
        padding: 20px;
        border: 10px solid green;
        margin: 30px
       }
    </style>
</head>
<body>
    <div class="box"></div>

    <script>
        //innerHeight和innerWidth获取一个元素的宽度高度+padding
        var height=$(".box").innerHeight();
        var width=$(".box").innerWidth();
        console.log(height,width);  //240 240
        
    </script>
</body>
</html>